import { Component, EventEmitter, Input, Output } from '@angular/core';
import { RgvRoadOrientation } from 'src/components/scenarios/enums';
import { FieldMapConfig, RgvRoadConfig } from 'src/components/scenarios/models';

@Component({
  selector: 'app-road-setting',
  templateUrl: './road-setting.component.html',
  styleUrl: './road-setting.component.scss'
})
export class RoadSettingComponent {
  private _cfg: RgvRoadConfig = {
    Orientation: RgvRoadOrientation.L2R,
    OffsetMin: 0,
    OffsetMax: 1000,
    RgvField: ""
  };
  @Input()
  public get cfg(): RgvRoadConfig {
    return this._cfg;
  }
  public set cfg(value: RgvRoadConfig) {
    this._cfg = value;
    this.cfgChange.emit(value);
  }

  orientations: RgvRoadOrientation[] = Object.values(RgvRoadOrientation);

  @Output()
  cfgChange: EventEmitter<RgvRoadConfig> = new EventEmitter();

  @Input()
  fields: FieldMapConfig[] = [];
}
